<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$title}</title>
    <link rel="shortcut icon" href="__STATIC__/src/common/img/cauliflower-small.png" type="image/x-icon" />
    <link rel="stylesheet" type="text/css"  href="__STATIC__/src/common/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css"  href="__STATIC__/src/common/css/common.css" />
    <link rel="stylesheet" type="text/css"  href="__STATIC__/src/common/css/mobiscroll.min.css" />
</head>
<body>
{include file="common/header"}
<div class="modal fade" id="leadIn" tabindex="-1" role="dialog" aria-labelledby="leadInLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" type="button" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">批量导入考生信息</h4>
            </div>
            <div class="modal-body">
                <form action="__ROOT__/teacher/Exam/batchLiExaminee" method="post" enctype="multipart/form-data">
                    <input type="text" name="examName" value="{$examName}" class="hidden"/>
                    <input type="text" readonly="readonly" id="filePath" style="width: 150px; position: absolute; left: 10px;"/>
                    <input type="file" name="examinee" style="width: 100px; position: absolute; left: 180px; z-index: 10; opacity: 0;" onchange="addFilePath(this)">
                    <button type="button" style="width: 100px; position: absolute; left: 180px;" class="btn btn-primary"><span class="glyphicon glyphicon-folder-open img-text"></span>选择</button>
                    <button type="submit" class="btn btn-primary" style="margin-left: 300px">导入</button>
                </form>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="paperModal" tabindex="-1" role="dialog" aria-labelledby="paperModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">上传考卷</h4>
            </div>
            <div class="modal-body">
                <form action="{:url('exam/uploadExampaper')}" method="post" enctype="multipart/form-data">
                    <input type="text" name="examName" value="{$examName}" class="hidden"/>
                    <input type="text" readonly="readonly" id="paperPath" style="width: 150px; position: absolute; left: 10px;"/>
                    <input type="file" name="paper" style="width: 100px; position: absolute; left: 180px; z-index: 10; opacity: 0;" onchange="addPaperPath(this)">
                    <button type="button" style="width: 100px; position: absolute; left: 180px;" class="btn btn-primary"><span class="glyphicon glyphicon-folder-open img-text"></span>选择</button>
                    <button type="submit" class="btn btn-primary" style="margin-left: 300px">上传</button>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" >取消</button>
            </div>
        </div>
    </div>
</div>
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div style="margin-bottom: 10px;">
                <form action="{:url('search')}" method="post">
                    <input type="text" style="display: none;" name="examName" value="{$examName}"/>
                    <select style="height: 30px; border: none; outline: none; cursor: pointer;" name="type">
                        <option selected="selected" value="id">考号</option>
                        <option value="name">姓名</option>
                        <option value="ip">ip地址</option>
                    </select><input type="text" name="key" style="height: 30px; outline: none; border: 1px solid black; border-radius: 4px;"><button type="submit" class="btn" style="font-weight: bold; background-color: rgba(0,0,0,0); outline: none;">搜索</button>
                </form>
            </div>
            <div class="alert alert-info {$alert}">
                <form enctype="multipart/form-data">
                    {$examName}暂无任何考生信息！立即<strong><a href="" data-toggle="modal" data-target="#leadIn">批量导入考生信息</a></strong>或者<strong><a href="{:url('Examinee/addOneExaminee')}">手动添加考生信息</a></strong>？
                </form>
                <!--<button class="close" data-dismiss="alert"><span>&times;</span></button>-->
            </div>
            <div class="alert alert-info {$paperAlert}">
                {$examName}还未上传考卷！立即<a href="" data-toggle="modal" data-target="#paperModal"><strong>上传</strong></a>？
            </div>
            <form action="{:url('Examinee/deleteExaminee')}" method="post">
                <input type="text" value="{$examName}" name="examName" style="display: none;"/>
                <table class="table table-striped table-bordered table-hover" style="display: {$table}">
                    <tr>
                        <th><input type="checkbox" onchange="checkAllOrNot(this)"/></th>
                        <th>考生考号</th>
                        <th>考生姓名</th>
                        <th>登录ip</th>
                        <th>是否交卷</th>
                        <th>是否锁定IP</th>
                    </tr>
                    {volist name="examinees" id="examinee"}
                    <tr>
                        <td><input type="checkbox" name="items[]" value="{$examinee.uniqueID}"/></td>
                        <td>{$examinee.studentID}</td>
                        <td>{$examinee.studentName}</td>
                        <td>
                            {if condition="$examinee.studentBindIP == '0.0.0.0'"}未登录
                            {else /}{$examinee.studentBindIP}
                            {/if}
                        </td>
                        <td>
                            {if condition="$examinee.isSubmit == '0'"}未提交
                            {else /}已提交
                            {/if}
                        </td>
                        <td>
                            {if condition="$examinee.isLockingIP == '0'"}未绑定<a href='{php}echo url("bindIP?who=".$examinee['id']."&examName=".$examName){/php}'><span class="glyphicon glyphicon-plus-sign" style="margin-left: 20px; cursor: pointer;" title="绑定ip" data-toggle="tooltip"></span></a>
                            {else /}已绑定<a href='{php}echo url("untieIP?who=".$examinee['id']."&examName=".$examName){/php}'><span class="glyphicon glyphicon-minus-sign" style="margin-left: 20px; cursor: pointer;" title="解绑ip" data-toggle="tooltip"></span></a>
                            {/if}
                        </td>
                    </tr>
                    {/volist}
                </table>
                {$examinees->render()}
                <div style="display: {$button};">
                    <button type="submit" class="btn btn-primary">删除考生</button>
                    <a data-toggle="modal" data-target="#leadIn" class="btn btn-primary">批量导入考生</a>
                    <a href="{:url('Examinee/addOneExaminee')}" class="btn btn-primary">手动添加考生</a>
                    <a href='{:url("exportExaminees?examName=$examName")}' class="btn btn-primary">导出学生信息</a>
                </div>
            </form>
            <div class="panel panel-default {$paperDiv}" style="margin-top: 20px;">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        考卷
                    </h3>
                </div>
                <div class="panel-body">
                    <span class="label label-info pointer normal-fontSize" title="{$paperPath}" data-toggle="tooltip">{$paperPath}</span>
                    <button class="btn btn-primary" data-toggle="modal" data-target="#paperModal">重新上传</button>
                    <a class="btn btn-primary" href='{:url("downloadExampaper?fileName=$paperPath")}'>下载考卷</a>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__STATIC__/src/common/js/jquery-3.2.1.js"></script>
<script src="__STATIC__/src/common/js/bootstrap.js"></script>
<script src="__STATIC__/src/common/js/admin.js"></script>
<script src="__STATIC__/src/common/js/mobiscroll.min.js"></script>
<script>
    $(function () {
        $("[data-toggle='tooltip']").tooltip();
    });
    function addFilePath(obj) {
        $("#filePath").val(obj.value);
    }
    function addPaperPath(obj) {
        $("#paperPath").val(obj.value);
    }
</script>
</body>
</html>